<?php

class User_Form_UserSearch extends Zend_Dojo_Form
{
    public function init()
    {    	
        $this->setName("UserSearch");
        $this->setMethod('post');
        $this->addAttribs(array('onSubmit'=>'return validate(this)'));
        
        $this->addElement('ValidationTextBox', 'username',array(        
	        'label'          => 'Usuário: ',
	        'regExp'         => '[\w]+',
	        'invalidMessage' => 'Usuário inválido',
        	'style'      	 => 'width: 250px;',
        ));

    $this->addElement('ValidationTextBox', 'fullname',array(        
        'label'          => 'Nome completo: ',
        'invalidMessage' => 'Nome inválido',
    	'style'      	 => 'width: 400px;',
    ));

     $this->addElement('ValidationTextBox', 'alias',array(        
        'label'          => 'Apelido: ',
        'required'       => false,
        'invalidMessage' => 'Usuário inválido',
    	'style'      	 => 'width: 250px;',
    ));

	$this->addElement('ValidationTextBox', 'email',array(        
    	'label'          => 'E-Mail: ',
		'regExp'         => '^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$',
    	'invalidMessage' => 'E-Mail inválido',
		'style'      	 => 'width: 250px;',
	));
        
   $this->addElement('DateTextBox', 'date_created',array(        
        'label'          => 'Data de Cadastro: ',
		'style'      	 => 'width: 100px;',
	    'required'       => false,
   ));

	$itensCountPerPageOptions = array('25'=>'25','60' =>'60', '120'=>'120','0'=>'Todos');
	$this->addElement('Select','item_count_per_page',array(
		'label'        => 'Mostrar : ',
		'value'        => 'item_count_per_page',
		'style'        => 'width: 100px;',
		'required'     => false,
		'autocomplete' => true,
		'multiOptions' => $itensCountPerPageOptions
	));
     
   $this->addElement('SubmitButton', 'button', array(
        'label'    => 'Pesquisar',
        'required' => false,
        'ignore' => true,
   ));
		        
        $this->addDisplayGroup(array('username','fullname','alias','email','date_created','item_count_per_page','button'), 'search', array('legend'=>"Pesquisar")); 

    }
}

